package com.zlll.winner.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import com.zlll.winner.business.service.activity.IActivityManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@JobHandler(value = "activityJob")
public class ActivityJob extends IJobHandler {

    @Autowired
    private IActivityManagementService service;

//    @Override
//    public ReturnT<String> execute(String... strings) throws Exception {
//        try {
//            service.todayUpdate();
//        } catch (Exception e) {
//            XxlJobLogger.log(e.getMessage());
//            return ReturnT.FAIL;
//        }
//        return ReturnT.SUCCESS;
//    }

    @Override
    public ReturnT<String> execute(String s) throws Exception {
        try {
            service.todayUpdate();
        } catch (Exception e) {
            XxlJobLogger.log(e.getMessage());
            return ReturnT.FAIL;
        }
        return ReturnT.SUCCESS;
    }
}
